package com.sugon.controller.device;

import com.sugon.entity.DevFaultPreventMeasure;
import com.sugon.service.DevFaultPreventMeasureService;
import com.sugon.utils.PageUtils;
import com.sugon.utils.Query;
import com.sugon.utils.R;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


/**
 * 设备故障预防措施CONTROLLER
 *
 * @author YuXD
 * @date 2023-04-06
 */
@Controller
@RequestMapping("devFaultPreventMeasure")
public class DevFaultPreventMeasureController {

    @Resource
    private DevFaultPreventMeasureService preventMeasureService;

    /**
     * 查看列表
     */
    @RequestMapping("/list")
    @ResponseBody
    public R list(@RequestParam Map<String, Object> params) {
        //查询列表数据
        Query query = new Query(params);
        List<DevFaultPreventMeasure> preventMeasureList = preventMeasureService.queryList(query);
        int total = preventMeasureService.queryTotal(query);
        PageUtils pageUtil = new PageUtils(preventMeasureList, total, query.getLimit(), query.getPage());
        return R.ok().put("page", pageUtil);
    }

}
